package com.bdqn.bookshop.controller.admin;

import com.bdqn.bookshop.entity.Notice;
import com.bdqn.bookshop.service.NoticeService;
import com.bdqn.bookshop.utils.DataGridViewResult;
import com.bdqn.bookshop.utils.Result;
import com.bdqn.bookshop.vo.NoticeVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author : 罗若然[LUO_RUO_RAN]
 * @date : 2020-07-29 10:46
 **/
@RestController
@RequestMapping("/admin/notice")
public class AdminNoticeController {

    @Autowired
    private NoticeService noticeService;

    @RequestMapping("/noticeList")
    public DataGridViewResult noticeList(NoticeVo noticeVo){
        return noticeService.noticeList(noticeVo);
    }

    @RequestMapping("/addNotice")
    public Result addNotice(Notice notice, HttpServletRequest request){
        return noticeService.addNotice(notice,request);
    }

    @RequestMapping("/updateNotice")
    public Result updateNotice(Notice notice){
        return noticeService.updateNotice(notice);
    }

    @RequestMapping("/deleteById")
    public Result deleteById(Integer id){
        return noticeService.deleteById(id);
    }

    @RequestMapping("/batchDelete")
    public Result batchDelete(String ids){
        return noticeService.batchDelete(ids);
    }
}
